#include "../../src/common/JsonUtil.h"
#include "../../src/common/Common.h"
#include "../../src/client/RpcClient.h"
#include <thread>

void callback(const std::string &topic, const string &msg)
{
    printf("%s 主题收到推送过来的消息： %s", topic.c_str(), msg.c_str());
}

int main(int argc, char const *argv[])
{
    auto client = std::make_shared<rpc::client::TopicClient>("127.0.0.1", 7070);

    if (!client->create("hello"))
    {
        cout << "主题创建失败" << endl;
        return -1;
    }

    client->subscribe("hello", callback);

    std::this_thread::sleep_for(std::chrono::seconds(10));
    client->shutdown();

    return 0;
}
